(function() {
  var __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  this.AccountRoutes = (function(_super) {

    __extends(AccountRoutes, _super);

    function AccountRoutes() {
      return AccountRoutes.__super__.constructor.apply(this, arguments);
    }

    AccountRoutes.prototype.routes = {
      "Account/LogOn*path": "LogOn",
      "Account/LogOn": "LogOn",
      "Account/LogOff": "LogOff",
      "Account/Edit*path": "Edit",
      "Account/ShowProfile/:login*path": "ShowProfile",
      "Account/ShowProfileRatedBooks/:login*path": "ShowProfileRatedBooks"
    };

    AccountRoutes.prototype.LogOn = function(path) {
      var layout, model, view;
      layout = new LibraryLayoutView();
      model = new LogOnModel();
      model.set("ReturnUrl", Url.GetParameterByName("ReturnUrl"));
      return view = new LogOnView({
        model: model
      });
    };

    AccountRoutes.prototype.LogOff = function() {
      var url, view;
      Loading.Start();
      view = new WelcomView({
        model: new WelcomModel()
      });
      url = SiteMap.Home.Index;
      view.render();
      return $.ajax({
        url: SiteMap.Account.LogOff,
        success: function() {
          return view.Navigate(url, true);
        }
      });
    };

    AccountRoutes.prototype.Edit = function(path) {
      var layout, model, view;
      layout = new LibraryLayoutView();
      model = new EditProfileModel();
      return view = new EditProfileView({
        model: model
      });
    };

    AccountRoutes.prototype.ShowProfile = function(login, path) {
      var layout, model, view;
      layout = new LibraryLayoutView();
      model = new ShowProfileModel();
      model.set("Login", login);
      return view = new ShowProfileView({
        model: model
      });
    };

    AccountRoutes.prototype.ShowProfileRatedBooks = function(login, path) {
      var column, direction, layout, model, view, viewType;
      layout = new LibraryLayoutView();
      model = new ProfileRatedBooksModel();
      model.set("Login", login);
      column = Url.GetParameterByName("Column");
      if (column.length) {
        model.setStaticProperty("Column", column);
      }
      direction = Url.GetParameterByName("Direction");
      if (direction.length) {
        model.setStaticProperty("Direction", parseInt(direction));
      }
      viewType = Url.GetParameterByName("viewType");
      if (viewType.length) {
        model.setStaticProperty("BookViewType", parseInt(viewType));
      }
      return view = new ProfileRatedBooksView({
        model: model
      });
    };

    return AccountRoutes;

  })(Backbone.Router);

}).call(this);
